<template>
  <el-card class="search" style="margin-top: 20px">
    <template #header>
      <el-menu
        :default-active="activeIndex"
        class="el-menu-demo"
        mode="horizontal"
        @select="handleSelect"
      >
        <el-menu-item index="1">销售额</el-menu-item>
        <el-menu-item index="4">访问量</el-menu-item>
      </el-menu>
      <div class="right">
        <el-radio-group v-model="size" style="margin-left: 20px">
          <el-radio-button label="large">今日</el-radio-button>
          <el-radio-button label="default">本周</el-radio-button>
          <el-radio-button label="small">本月</el-radio-button>
          <el-radio-button label="small">今年</el-radio-button>
        </el-radio-group>
        <el-date-picker
          style="margin-left: 20px"
          v-model="value"
          type="daterange"
          range-separator="至"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          :size="size"
        />
      </div>
    </template>
  </el-card>
</template>

<script lang="ts">
export default {
  name: "SearchData",
};
</script>

<script lang="ts" setup>
import { ref } from "vue";

const activeIndex = ref("1");
const handleSelect = (key: string, keyPath: string[]) => {
  console.log(key, keyPath);
};

// 日期选择器
const size = ref<"" | "large" | "small">("");
const value = ref("");
</script>

<style lang="scss" scoped>
.search {
  position: relative;
  .right {
    position: absolute;
    right: 20px;
    top: 25px;
    display: flex;
    align-items: center;
  }
}
</style>
